﻿<%@ Page Title="" Language="C#" MasterPageFile="~/WebSite.Master" AutoEventWireup="true"
    CodeBehind="ExpertManagerMain.aspx.cs" Inherits="RN.ERP.Web.Expert.ExpertManagerMain" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link id="Link1" runat="server" href="../Styles/skins/expert/css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../Scripts/ligerUI/js/ligerui.min.js"></script>
    <script type="text/javascript">
        function Refresh(type) {
            ////刷新最上方的工具栏
            var tabs = top.tab.getTabidList("", "");
            for (var i = 0; i < tabs.length; i++) {
                top.tab.reload(tabs[i]);
            }
            if (type != null && type != "" && type == "Add") {
                top.tab.addTabItem({ tabid: new Date().getTime(), text: "企业信息管理", url: "Enterprise/EnterpriseCorpInfo.aspx" });
            }
        }

        function refreshShowLoading(objId) {
            $("#gridLoading").show();
        }

        function refreshHideLoading(objId) {
            $("#gridLoading").hide();
        }

        function refreshShowLoading(objId) {
            $("#gridLoading").show();
        }

        function PassExec(title) {
            $.ligerDialog.prompt(title, '', true, function (yes, value) {
                if (yes) {
                    $("#<%= hdnComments.ClientID %>").val(value);
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Audit");
                }else {
                    return false;
                }
            });
        }

        function RejectExec(title) {
            $.ligerDialog.prompt(title, '', true, function (yes, value) {
                if (yes) {
                    $("#<%= hdnComments.ClientID %>").val(value);
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Back");
                }
                else {
                    return false;
                }
            });
        }
    </script>
    <script type="text/javascript">
        //审核之前判断
        function CheckPersonSel() {
            var chk = $("input:checked", $("#personEmp"));
            if (chk.length == 0) {
                $.ligerDialog.warn("请选择要修改的项！");
                return false;
            }
            return true;
        }

        function GetCheckPersonVal() {
            var empGuid = "";
            $("input:checked", $("#personEmp")).each(function () {
                empGuid += "," + $(this).val();
            });
            if (empGuid.length > 1) {
                empGuid = empGuid.substring(1);
            }
            return empGuid;
        }

        /*人员审核退回*/
        function CheckPersonAudit(opt,obj) {
            if (!CheckPersonSel()) {
                return false;
            }

            if (opt == 5) {
                $("#hidIsLimitedPass").val("false");
                PassExec("审核通过意见");
            } else if (opt == 6) {
                RejectExec('退回意见');
            } else if (opt == 51) {
                $("#hidIsLimitedPass").val("true");
                PassExec("有条件审核通过意见");
            }
            return false;
        }

        /*查看人员*/
        function CheckPersonView() {
            if (!CheckPersonSel()) {
                return false;
            }
            var chk = $("input:checked", $("#personEmp"));
            if (chk.length > 1) {
                $.ligerDialog.warn("只能选择一项！");
                return false;
            }
            var empGuid = GetCheckPersonVal();
            ShowViewPerson(empGuid, 1);

        }

        $(function () {
            $("#btnSearch").click(function () {
                refreshPersonGrid();
            });
        });

        /*刷新*/
        function refreshPersonGrid() {
            $find("<%= RadAjaxManager1.ClientID%>").ajaxRequest("Person");
        }
        function OpenAlertPerson(text) {
            $.ligerDialog.warn(text);
            return false;
        }
        /*打开窗口*/
        function ShowViewPerson(empGuid1, opt) {
            top.ChildDialog = top.$.ligerDialog.open({ url: "Person/PersonExpertInfo.aspx?empGuid=" + empGuid1, width: 1080, height: 800, title: '', buttons: [{ text: '关闭', onclick: function (item, dialog) { dialog.close(); } }] });
            top.setChildDialogClose(this, "OnClientCloseAudit");
            return false;
        }

        function OnClientClosePerson(oWnd, args) {
            var arg = args.get_argument();
            if (arg) {
                if (arg.Result == 1) {
                    refreshPersonGrid();
                }
            }
        }

        function OnClientCloseAudit(args) {
            if (args == 1) {
                refreshPersonGrid();
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <input type="hidden" runat="server" id="hdnComments" />
    <input type="hidden" runat="server" id="hidSysError" />
    <input type="hidden" runat="server" id="hidIsLimitedPass" clientidmode="Static" />

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgPersonList" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rgPersonList">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgPersonList" LoadingPanelID="RadAjaxLoadingPanel1">
                    </telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
<%--        <ClientEvents OnRequestStart="refreshShowLoading" OnResponseEnd="refreshHideLoading" />--%>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
    <div class="right">
        <table width="99%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom: 10px;table-layout:fixed;">
            <tr>
                <td class="xx_m  tt_xx_l"></td>
                <td class="xx_m  tt_xx_icon"></td>
                <td style="width:auto;" class="xx_m">待办事项</td>
                <td style="width:14px;"><img src="../images/xx_r.jpg" width="14" height="33" /></td>
            </tr>
            <tr>
                <td class="left_con">
                </td>
                <td colspan="2">
                    <div id="con">
                        <ul id="tags">
                            <li class="selectTag">
                                <a onclick="selectTag('tagContent0',this)" href="javascript:void(0)">待审专家</a>
                            </li>
                        </ul>
                        <div id="tagContent">
                            <div style="text-align:center;">
                                <img id="gridLoading" style="display:none;" src="../Scripts/ligerUI/skins/Aqua/images/common/bigloading.gif" />
                            </div>
                            <div class="tagContent selectTag" id="tagContent0">
                                <div style=" float:left; width:50%;">
                                    <div style="float:left"> 姓名： </div>
                                    <asp:TextBox ID="txtName" runat="server" CssClass="input_t" />
                                     <asp:DropDownList ID="ddlStatus" runat="server" Style="width: 100px;float:left; height: 28px;
                                        line-height: 27px; margin-left: 5px;border: 1px solid #eaeaea;">
                                    </asp:DropDownList>
                                    <input class="search_t" id="btnSearch" name="search" type="button" />
                                </div>
                                <div style="float:right; width:50%;">
                                    <div class="i-con-cn">
                                        <input type="button" class="xtbiao" onclick="CheckPersonAudit(6,this)" value="退回" />
                                        <input type="button" class="xtbiao02" onclick="CheckPersonAudit(5,this)" value="批量审核通过" />
                                        <input type="button" class="xtbiao02" onclick="CheckPersonAudit(51,this)" value="批量有条件通过" />
                                    </div>
                                </div>
                                <div style="clear: both; width: 99%;" id="personEmp">
                                <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel" LoadingPanelID="RadAjaxLoadingPanel1"
                                     HorizontalAlign="NotSet">
                                    <telerik:RadGrid ID="rgPersonList" runat="server" 
                                        AutoGenerateColumns="False" AllowPaging="True" AllowCustomPaging="True" AllowMultiRowSelection="true" OnNeedDataSource="rgPersonList_NeedDataSource"
                                        AllowFilteringByColumn="false" AllowSorting="True" PageSize="10" ShowStatusBar="True"
                                        CellSpacing="0" Culture="zh-CN" GridLines="None">
                                        <ClientSettings ReorderColumnsOnClient="True" AllowColumnsReorder="False" EnableRowHoverStyle="true">
                                            <Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True"
                                                AllowColumnResize="True"></Resizing>
                                        </ClientSettings>
                                        <MasterTableView AutoGenerateColumns="False" DataKeyNames="EmpGuid" NoMasterRecordsText="暂无数据">
                                            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                                            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                                            </RowIndicatorColumn>
                                            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                                            </ExpandCollapseColumn>
                                            <Columns>
                                                <telerik:GridTemplateColumn HeaderText="选择" HeaderStyle-Width="50px">
                                                    <HeaderTemplate>
                                                        <asp:CheckBox ID="headerChkbox" runat="server" OnCheckedChanged="ToggleSelectedState"
                                                            AutoPostBack="True" />
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <asp:CheckBox ID="CheckBox1" runat="server" OnCheckedChanged="ToggleRowSelection" 
                                                        AutoPostBack="True" ></asp:CheckBox>
                                                    </ItemTemplate>
                                                    <ItemStyle Width="50px"></ItemStyle>
                                                </telerik:GridTemplateColumn>
                                                <telerik:GridBoundColumn DataField="EmpGuid" DataType="System.String" HeaderText="EmpGuid"
                                                    UniqueName="EmpGuid" Visible="false">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridTemplateColumn HeaderText="姓名" HeaderStyle-Width="60px">
                                                    <ItemTemplate>
                                                        <a href="javascript:void(0);" onclick="ShowViewPerson('<%#Eval("EmpGuid") %>',1)"
                                                            title="点击查看人员信息"><span style="color: #43a9f5">
                                                                <%#Eval("Name") %></span></a>
                                                    </ItemTemplate>
                                                    <ItemStyle Width="60px"></ItemStyle>
                                                </telerik:GridTemplateColumn>
                                                <telerik:GridCalculatedColumn SortExpression="Sex" HeaderText="性别" DataFields="Sex" HeaderStyle-Width="40px"
                                                    Expression='{0}==1?"男":"女"' FooterText="CalculatedColumn footer">
                                                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                                    <ItemStyle Width="40px" HorizontalAlign="Center"></ItemStyle>
                                                </telerik:GridCalculatedColumn>
                                                <telerik:GridBoundColumn DataField="corpName" DataType="System.String" HeaderText="单位名称" HeaderStyle-Width="200px"
                                                    SortExpression="corpName">
                                                    <ItemStyle Width="200px"></ItemStyle>
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="MainSpec" DataType="System.String" HeaderText="主专业" HeaderStyle-Width="200px"
                                                    SortExpression="MainSpec">
                                                    <ItemStyle Width="200px"></ItemStyle>
                                                </telerik:GridBoundColumn>
<%--                                                <telerik:GridCalculatedColumn SortExpression="IDType" HeaderText="证件类型" DataFields="IDType"
                                                    Expression='{0}=="1"?"身份证":"其他"' FooterText="CalculatedColumn footer">
                                                    <ItemStyle Width="60px"></ItemStyle>
                                                </telerik:GridCalculatedColumn>--%>
                                                <telerik:GridBoundColumn DataField="IDCard" DataType="System.String" HeaderText="身份证号"
                                                    SortExpression="IDCard" UniqueName="IDCard" HeaderStyle-Width="135px">
                                                    <ItemStyle Width="135px"></ItemStyle>
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="MobileTel" FilterControlAltText="Filter MobileTel column"
                                                    HeaderText="手机号" SortExpression="MobileTel" UniqueName="MobileTel" HeaderStyle-Width="80px">
                                                    <ItemStyle Width="80px" />
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="StrFlowCode" DataType="System.String" HeaderText="审核状态"
                                                    SortExpression="StrFlowCode">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn HeaderText="审核流程码" DataField="FlowCode" UniqueName="FlowCode"
                                                    ItemStyle-Width="100px" Visible="false">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="TypeFlag" DataType="System.String" Visible="false">
                                                </telerik:GridBoundColumn>
                                            </Columns>
                                        </MasterTableView>
                                        <PagerStyle AlwaysVisible="True" />
                                        <FilterMenu EnableImageSprites="False">
                                        </FilterMenu>
                                    </telerik:RadGrid>
                                </telerik:RadAjaxPanel>
                                </div>
                            </div>
                        </div>
                    </div>
                </td>
                <td class="right_con">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="con_m tt_left_bottom">&nbsp;</td>
                <td colspan="2" class="con_m">
                    &nbsp;
                </td>
                <td class="tt_right_bottom">&nbsp;</td>
            </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="51%" style="vertical-align:top;">
                    <table width="99%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td style="width:19px" class="xx_m">
                                <img src="../images/xx_l.jpg" width="19" height="33" />
                            </td>
                            <td style="width:31px" class="xx_m">
                                <img src="../images/xx.jpg" width="24" height="33" />
                            </td>
                            <td style="width:auto" class="xx_m">
                                信息互递
                            </td>
                            <td style="width:19px">
                                <img src="../images/xx_r.jpg" width="14" height="33" />
                            </td>
                        </tr>
                        <tr>
                            <td class="left_con">
                            </td>
                            <td colspan="2">
                                <div id="chatBriefDiv"></div>
                            </td>
                            <td class="right_con">
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td class="con_m tt_left_bottom">&nbsp;</td>
                            <td colspan="2" class="con_m">
                                &nbsp;
                            </td>
                            <td class="tt_right_bottom">&nbsp;</td>
                        </tr>
                    </table>
                </td>
                <td width="49%" style="vertical-align:top;">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="19px" class="xx_m">
                                <img src="../images/xx_l.jpg" width="19" height="33" />
                            </td>
                            <td width="31px" class="xx_m">
                                <img src="../images/xtxx.jpg" width="24" height="33" />
                            </td>
                            <td width="auto" class="xx_m">
                                系统消息
                            </td>
                            <td width="19px">
                                <img src="../images/xx_r.jpg" width="14" height="33" />
                            </td>
                        </tr>
                        <tr>
                            <td class="left_con">
                            </td>
                            <td colspan="2">
                                <div id="letterBriefDiv"></div>
                            </td>
                            <td class="right_con">
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td class="con_m tt_left_bottom">&nbsp;</td>
                            <td colspan="2" class="con_m">
                                &nbsp;
                            </td>
                            <td class="tt_right_bottom">&nbsp;</td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="WebBlue" EnableShadow="true"></telerik:RadWindowManager>
    <asp:HiddenField ID="hdnSelectTagName" Value="tagContent0" runat="server" />
    <script>
        (function () {
            var chatBrief = $("#chatBriefDiv")
                , letterBrief = $("#letterBriefDiv")
                , Users = top.Users
                , userStore = {}
                , roleStore = {
                    "88": "主管1"
                    , "101": "主管2"
                    , "110": "主管3"
                    , "42": "监理企业"
                    , "15": "施工企业"
                    , "other": "其他"
                };
            if (!Users) {
                $.get("../Message/MsgPushHandler.ashx", { Func: "GetUsers" }, function (data) {
                    if (!data) {
                        $.ligerDialog.error("用户列表获取失败！");
                    }
                    Users = data;
                    InitUser();
                }, "json");
            }
            if (!Users) return;

            InitUser();
            BindLetterBrief();

            function InitUser() {
                for (var i = 0; i < Users.length; i++) {
                    userStore[Users[i].UserGuid] = Users[i];
                }
            }

            function BindLetterBrief() {
                $.get("../Message/MsgPushHandler.ashx", { Func: "GetLetterBrief" }, function (data) {
                    if (!data) {
                        letterBrief.html("站内信获取失败.");
                    } else {
                        ShowLetterBrief(data);
                    }
                }, "json");
            }

            function ShowLetterBrief(data) {
                var html = "<table style='width:100%;'>";

                for (var i = 0, len = data.length; i < len; i++) {
                    html += "<tr>";
                    html += "<td>" + (roleStore[data[i].Receiver] || (userStore[data[i].Receiver] ? userStore[data[i].Receiver].Name : null) || roleStore["other"]) + "</td>";
                    html += "<td>&nbsp;" + data[i].SendTime + "</td>"
                    html += "<td>&nbsp;" + nodeTextToShort(data[i].MsgText) + "</td>"
                    html += "</tr>";
                }
                html += "</table>";
                letterBrief.html(html);
                $("<a href='###'>更多</a>").css({ color: "blue" }).click(function () {
                    top.addTabExtend(top.$("#siteLetterLi"), 'Message/MessageList.aspx', '站内信');
                    top.$("#chatCountor").empty();
                }).appendTo(letterBrief);
            }

            function nodeTextToShort(text, len) {
                var MAX_NODETEXT_LENGTH = len || 20;
                if (text.length > MAX_NODETEXT_LENGTH) {
                    return text.substring(0, MAX_NODETEXT_LENGTH - 1) + "...";
                }
                return text;
            }

        })();

        function selectTag(showContent, selfObj) {
            // 操作标签
            var tag = document.getElementById("tags").getElementsByTagName("li");
            var taglength = tag.length;
            for (i = 0; i < taglength; i++) {
                tag[i].className = "";
            }
            selfObj.parentNode.className = "selectTag";
            
            // 操作内容
            for (i = 0; j = document.getElementById("tagContent" + i); i++) {
                j.style.display = "none";
            }
            document.getElementById(showContent).style.display = "block";
            ////动态加载内容中的列表
            $("#ContentPlaceHolder1_hdnSelectTagName").val(showContent);
            if (showContent == "tagContent0") {
                refreshPersonGrid();
            }
        }
    </script>
</asp:Content>
